﻿using System;
using System.Reflection;
using Castle.ActiveRecord;
using WebConversion.Common.Configuration;
using WebConversion.Module;
using WebConversion.Module.MemberShip;
using WebConversion.Runtime;

namespace WebConversion.Test
{
    public class TestBase
    {
        public static readonly string AppDirectory;
        public static readonly string WebDirectory;
        
        static TestBase()
        {
            AppDirectory = AppDomain.CurrentDomain.BaseDirectory;
            WebDirectory = AppDirectory.Substring(0, AppDirectory.LastIndexOf("WebConversion.Test", StringComparison.Ordinal)) 
                + "WebConversion.Mvc" + "\\";
            var dataDirectory = WebDirectory  + "App_Data" + "\\";
            AppDomain.CurrentDomain.SetData("DataDirectory", dataDirectory);

            InitActiveRecord();
        }

        private static void InitActiveRecord()
        {
            RuntimeManager.Init();
        }
    }
}
